Function addPerlExtension ()
    Dim oThisServer, sPerlExecutable
    
    sPerlExecutable = Session.Property("SCRIPTIISEXTENSION")

    On Error Resume Next 
    Set oThisServer = GetObject( "IIS://localhost/W3SVC" ) 
      
    If( Err.Number <> 0 ) Then 
        MsgBox "Unable to access IIS API - " & _ 
            "please ensure that IIS is running" & vbCrLf & _ 
            "    - Error Details: " & Err.Description & " [Number:" & _ 
            Hex(Err.Number) & "]", vbCritical, "Error" 
            addPerlExtension = ERROR_INSTALL_FAILURE 
        Exit Function 
    Else 
    	  oThisServer.DeleteExtensionFileRecord sPerlExecutable
    	  oThisServer.SetInfo
    	  
    	  oThisServer.AddExtensionFile sPerlExecutable, True, "PERL", True, "Perl CGI Extension" 
    	  oThisServer.SetInfo
    	  
    End If
    
    addPerlExtension = ERROR_SUCCESS
    
End Function

Function removePerlExtension ()
    Dim oThisServer, sPerlExecutable
    
    sPerlExecutable = Session.Property("SCRIPTIISEXTENSION")
				
    On Error Resume Next 
    Set oThisServer = GetObject( "IIS://localhost/W3SVC" ) 
      
    If( Err.Number <> 0 ) Then 
        MsgBox "Unable to access IIS API - " & _ 
            "please ensure that IIS is running" & vbCrLf & _ 
            "    - Error Details: " & Err.Description & " [Number:" & _ 
            Hex(Err.Number) & "]", vbCritical, "Error" 
            removePerlExtension = ERROR_INSTALL_FAILURE 
        Exit Function 
    Else 
    		iAnswer = MsgBox("Do you want to remove the IIS Perl CGI Extension?", 36, "Extension removal" )
  	
  	    If Not iAnswer = 7 Then
    	    oThisServer.DeleteExtensionFileRecord sPerlExecutable
    	    oThisServer.setInfo
    	  End If
    End If
    
    removePerlExtension = ERROR_SUCCESS
End Function